#ifndef _COFF_CHANGER_H_
#define _COFF_CHANGER_H_

#include <vector>
#include "CoffBucket.h"

using namespace std;

class CPattern;

class CCoffChanger
{
public:
	CCoffChanger( CPattern * pattern );
	static CCoffChanger * GetInstance( CPattern* pattern );
	virtual bool Change( char _coff[REF_PIXEL_NUMBER] ) = 0;

	int GetRand( int n );

protected:
	CPattern * m_pPattern;
};


class CCoffChangerGA : public CCoffChanger
{
public:
	CCoffChangerGA( CPattern * pattern );
	~CCoffChangerGA();
	bool Change( char _coff[REF_PIXEL_NUMBER] );

private:
	bool DoSelection();
	bool DoCrossOver();
	bool DoMutation();
	bool DoCleanUp();
	bool ClearList();
	bool DoCrossOverWithDNA( char * first, char * second );


	vector<CCoffItem*> * m_pvecCoffList;
	vector<CCoffItem*>::iterator m_iterCurrentCoff;
};

#endif // _COFF_CHANGER_H_
